package org.emavaj.sanguosha.controller.card;

import org.emavaj.sanguosha.model.card.AbstractCard;
import org.emavaj.sanguosha.view.gameview.GameFrame;

/**
 * 
 * @author eMavaj
 *
 */
public class CardDispatchController {
	
	private int fromId;
	private AbstractCard beOfferedCard;
	
	private int toId;
	private AbstractCard sendOutCard;
	
	private GameFrame owner;
	
	public void resetBeOfferedInfo() {
		fromId = -1;
		beOfferedCard = null;
	}
	
	public void resetSendInfo() {
		toId = -2;
		sendOutCard = null;
	}
	
	public CardDispatchController(GameFrame owner) {
		this.owner = owner;
		resetBeOfferedInfo();
		resetSendInfo();
	}
	
	public boolean checkFeedbackCard(AbstractCard card) {
		return this.beOfferedCard.isFeedBackWork(card);
	}
	
	public void cardHitsTarget() {
		this.sendOutCard.hitTaget(owner);
	}
	
	public int getFromId() {
		return fromId;
	}
	public void setFromId(int fromId) {
		this.fromId = fromId;
	}
	public AbstractCard getBeOfferedCard() {
		return beOfferedCard;
	}
	public void setBeOfferedCard(AbstractCard sendCard) {
		this.beOfferedCard = sendCard;
	}
	public AbstractCard getSendOutCard() {
		return sendOutCard;
	}
	public void setSendOutCard(AbstractCard sendOutCard) {
		this.sendOutCard = sendOutCard;
	}
	public int getToId() {
		return toId;
	}
	public void setToId(int toId) {
		this.toId = toId;
	}
}
